package com.homeproject.trailservice.grpc;

import com.homeproject.trailservice.grpc.grouppurchasepkg.GroupPurchaseServiceGrpc.GroupPurchaseServiceImplBase;
import com.homeproject.trailservice.grpc.grouppurchasepkg.PurchaseResponse;
import net.devh.boot.grpc.server.service.GrpcService;

@GrpcService(interceptors = {ContextPropagationInterceptor.class})
public class GroupPurchaseServiceGrpcImpl extends GroupPurchaseServiceImplBase {

    @Override
    public void submitAPurchase(com.homeproject.trailservice.grpc.grouppurchasepkg.PurchaseRequest request,
                                io.grpc.stub.StreamObserver<com.homeproject.trailservice.grpc.grouppurchasepkg.PurchaseResponse> responseObserver) {
        String propagatedKey = GrpcContextKeys.TEST_KEY.get();
        responseObserver.onNext(PurchaseResponse.newBuilder().setPurchaseResult(propagatedKey).build());
        responseObserver.onCompleted();
    }

}
